package com.lysj.admin.master.auth.domain;

import com.baomidou.mybatisplus.annotation.TableName;
import com.lysj.admin.master.common.spring.base.BaseEntity;
import com.lysj.admin.master.common.spring.mpbase.MyEntity;
import com.lysj.admin.master.common.validation.annotation.NotBlank;
import com.lysj.admin.master.common.validation.annotation.Range;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;

/**
 * @author Created by zk on 2019-12-05 2:15
 * @description
 */
@Data
@Entity
@EqualsAndHashCode(callSuper = true)
@TableName("lysj_auth_permission")
@Table(name = "lysj_auth_permission",
        indexes = {@Index(name = "idx_parent_id", columnList = "parentId"),
                @Index(name = "idx_sort_order", columnList = "sortOrder")})
public class Permission extends MyEntity {
    @Range(min = "1", minEqual = true, max = "3", maxEqual = true, message = "层级取值范围为1-3")
    private Integer level;//层级

    @NotBlank(message = "请填写路径")
    private String path;//路径

    private String icon;//图标

    private String parentId;//父ID

    private String description;//描述

    private Integer sortOrder;//排序值

    private Integer visible = 1;// 是否可见 1:可见,2:不可见

    private  String type; //用户类型,区分当前登录用户(ISS)

    private transient List<Permission> children;//子菜单
}
